<html>
<head><meta charset="utf-8"><title>Nicer Assert Messages · project-error-handling · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/index.html">project-error-handling</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html">Nicer Assert Messages</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="214732045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214732045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214732045">(Oct 27 2020 at 17:10)</a>:</h4>
<p>I have a lot of errors to work through.  These are the steps I took leading up to said errors:  I forked and cloned <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs">https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs</a>  to my lapton(MacOS).  At that point there were only 2 errors.  At this point I received the guide <a href="https://rustc-dev-guide.rust-lang.org/">https://rustc-dev-guide.rust-lang.org/</a>  from DPC and went to the building and debugging rustc section.  I filled in the config.toml file according to instructions and then ran ./x.py check   which produced 2 errors (1) couldn't find required command: "cmake"  and (2) failed to run rust/build/bootstrap/debug/bootstrap check</p>



<a name="214734016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214734016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214734016">(Oct 27 2020 at 17:24)</a>:</h4>
<p><span class="user-mention" data-user-id="344328">@Charles Ellis O'Riley Jr.</span> you need to install cmake</p>



<a name="214734054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214734054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214734054">(Oct 27 2020 at 17:24)</a>:</h4>
<p>on linux, that's <code>sudo apt install cmake</code>, not sure about windows</p>



<a name="214735050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214735050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214735050">(Oct 27 2020 at 17:30)</a>:</h4>
<p>I’m on a Mac so I assume it’s the same as linux</p>



<a name="214735314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214735314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214735314">(Oct 27 2020 at 17:32)</a>:</h4>
<p>on mac you'd use <code>brew</code> I think</p>



<a name="214735346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214735346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214735346">(Oct 27 2020 at 17:32)</a>:</h4>
<p>or any other package manager you have installed</p>



<a name="214735437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214735437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214735437">(Oct 27 2020 at 17:33)</a>:</h4>
<p>Thanks Joshua</p>



<a name="214781666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214781666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214781666">(Oct 28 2020 at 00:19)</a>:</h4>
<p>The build completed successfully. There are a multitude of problems popping up though.  A few of which are as follows:  (1) extern location for smallvec does not exist.  This is emanating from the file <a href="http://ieee.rs">ieee.rs</a> where the calling is "use smallvec::{smallvec, SmallVec};"  (2) #![feature(nll)] feature may not be used on the stable release channel.  This file is src/lib.rs.  Do I need to comment this feature out?  (3) #[doc(alias = "==")] doc alias is experimental.  That's it for now.  Thanks.</p>



<a name="214783283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214783283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214783283">(Oct 28 2020 at 00:42)</a>:</h4>
<p>I researched the 2nd error and it seems that I need to run nightly Rust.   I'm running the stable release so do I need to run nightyly for this project?  Thanks.</p>



<a name="214786594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214786594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214786594">(Oct 28 2020 at 01:32)</a>:</h4>
<p>How are you building the project? x.py should set RUSTC_BOOTSTRAP which fixes those errors</p>



<a name="214786638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214786638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214786638">(Oct 28 2020 at 01:32)</a>:</h4>
<p>Unfortunately <code>cargo build</code> does not work on rustc itself</p>



<a name="214787107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214787107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214787107">(Oct 28 2020 at 01:39)</a>:</h4>
<p>Hi Josh.  I ran ./x.py check</p>



<a name="214787491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214787491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214787491">(Oct 28 2020 at 01:46)</a>:</h4>
<p>After I downloaded cmake, I ran ./x.py check and received a message that it compiled successfully. I did have the bootstrap error which I now no longer have.  The issues I stated are showing up in the PROBLEMS tab of VSCode.</p>



<a name="214787647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214787647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214787647">(Oct 28 2020 at 01:48)</a>:</h4>
<p>I did not do cargo build.</p>



<a name="214787822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214787822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214787822">(Oct 28 2020 at 01:51)</a>:</h4>
<p>VSCode runs cargo build. I wouldn't trust the IDE errors, x.py is unfortunately the only source of truth for whether your changes are correct.</p>



<a name="214787834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214787834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214787834">(Oct 28 2020 at 01:51)</a>:</h4>
<p>I think we have suggestions for making vscode go through x.py instead</p>



<a name="214787846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214787846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214787846">(Oct 28 2020 at 01:51)</a>:</h4>
<p><a href="https://rustc-dev-guide.rust-lang.org/building/suggested.html?highlight=vscode#configuring-rust-analyzer-for-rustc">https://rustc-dev-guide.rust-lang.org/building/suggested.html?highlight=vscode#configuring-rust-analyzer-for-rustc</a></p>



<a name="214788026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/214788026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#214788026">(Oct 28 2020 at 01:54)</a>:</h4>
<p>Thanks Joshua.  I'll take a look.</p>



<a name="216033862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216033862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216033862">(Nov 09 2020 at 00:34)</a>:</h4>
<p>Status:  Ran a successful x.py setup.  Thanks <span class="user-mention" data-user-id="232545">@Joshua Nelson</span>  for your assistance.  Becoming more comfortable with the layout of the compiler and reading about the AST.  I just started going through the documentation for "The compiler testing framework" .  No code changes yet.</p>



<a name="216080665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216080665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216080665">(Nov 09 2020 at 13:04)</a>:</h4>
<p>I will not be able to be at the meeting today.  My previous entry is my status.  Wrapping my mind around AST.  Compiler testing will be essential to know.</p>



<a name="216119753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216119753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216119753">(Nov 09 2020 at 17:49)</a>:</h4>
<p>sounds good</p>



<a name="216420548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216420548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216420548">(Nov 12 2020 at 02:21)</a>:</h4>
<p>I reached out to the author here:  <a href="https://github.com/ishitatsuyuki/rfcs/blob/generic-assert/text/0000-generic-assert.md">https://github.com/ishitatsuyuki/rfcs/blob/generic-assert/text/0000-generic-assert.md</a> because I felt that his examples are what I need to implement.  The following is his reply:  </p>
<hr>
<p>"The original implementation idea for the <code>assert!</code> macro is to simply transform the expression into printing code, just like what <code>println!</code> does. Unfortunately, it turned out that many <code>assert!</code> uses today is not compatible with this, as the variables referenced don't necessarily implement <code>Debug</code>. As a result, a "plain text fallback" was described in the RFC to preserve backward compatibility, but that has become a huge roadblock for implementing the RFC.</p>
<p>Before I talk about the internals of "fallback", I'd like to slightly clarify how macros like <code>println!</code> works. Some macros like <code>println!</code> is not implemented through <code>macro_rules!</code>; instead, they are implemented as a compiler built-in and therefore can do much more flexible transforms to the arguments.</p>
<p>And to power up the <code>assert!</code> macro, it was also changed to be a compiler builtin. You might think that, if a macro is a compiler builtin, then can't it just "check" if a type passed is <code>Copy</code> or not? Unfortunately, the answer is currently no. A macro runs at the parsing stage, where the compiler has no access to type information. At this point, the only viable alternative is to do some "hack" through the highly unstable and unsound specialization, but the compiler team had some objection since they don't want to introduce more use of this unstable feature which might get removed some day."</p>
<hr>
<p>@Charles O'Riley:  My thoughts:  Initially i felt I could achieve the results needed using polymorphism, i.e., creating an additional assert with the signature of assert_eq,  but after all the reading, i.e., AST, and going back to the original assert code, I'm not sure.  One question I do have is if <a href="http://assert.rs">assert.rs</a>, which is currentyly in the src directory underneath rustc_builtin_macros needs to be moved/replicated to the src directory under proc_macro/bridge?  Any feedback would be welcome.  Thanks. <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="216422409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216422409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216422409">(Nov 12 2020 at 02:58)</a>:</h4>
<p>What about using multiple dispatch? Or is that the unsound specialization<br>
being referred to?</p>



<a name="216422536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216422536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216422536">(Nov 12 2020 at 03:00)</a>:</h4>
<p>@oliver** I can't answer that off the top of my head.  I would have to research it and then still probably have questions.  I'm literally taking this one step at a time.</p>



<a name="216422571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216422571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216422571">(Nov 12 2020 at 03:01)</a>:</h4>
<p>It would be nice to know more about "the highly unstable <br>
and unsound specialization", it leaves a lot to the imagination</p>



<a name="216422759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216422759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216422759">(Nov 12 2020 at 03:05)</a>:</h4>
<p>Good point.  I'll see if I can get some feedback on that.  As to my other question, does the assert need to be moved to the src directory under proc_macro/bridge?</p>



<a name="216424801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216424801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216424801">(Nov 12 2020 at 03:46)</a>:</h4>
<p>for some reason I thought that it would be possible to make a built-in that does type checking</p>



<a name="216424825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216424825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216424825">(Nov 12 2020 at 03:47)</a>:</h4>
<p>what about autoderef specialization?</p>



<a name="216424829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216424829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216424829">(Nov 12 2020 at 03:47)</a>:</h4>
<p>that's not particularly fragile</p>



<a name="216424877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216424877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216424877">(Nov 12 2020 at 03:48)</a>:</h4>
<p>Feedback I just received:</p>
<p>Specialization is a feature that allows to override the trait implementation for a particular type. (Normally the compiler will not allow overlapping impls.) You can read about it at the tracking issue: <a href="https://github.com/rust-lang/rust/issues/31844">https://github.com/rust-lang/rust/issues/31844</a>. As you can see from the issue, the feature has gone through a long debate and yet it still isn't stabilized. In fact, the compiler team is actually going in the direction to remove it and replace it with some alternative design (e.g. always-applicable impls, <a href="http://smallcultfollowing.com/babysteps/blog/2018/02/09/maximally-minimal-specialization-always-applicable-impls/">http://smallcultfollowing.com/babysteps/blog/2018/02/09/maximally-minimal-specialization-always-applicable-impls/</a>). So that's what I mean with "highly unstable and unsound specialization".</p>
<p>By the way, the "hack" I mentioned is implemented by @sinkuu as a prototype in <a href="https://github.com/sinkuu/rust/commit/ba00a0effd4c51f7c98247b994661a6db31ea7de">https://github.com/sinkuu/rust/commit/ba00a0effd4c51f7c98247b994661a6db31ea7de</a>. Maybe it would give you an idea how it might look like.</p>



<a name="216424878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216424878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216424878">(Nov 12 2020 at 03:48)</a>:</h4>
<p>just need a debug case and a default case that uses the stringified repr</p>



<a name="216424969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216424969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216424969">(Nov 12 2020 at 03:50)</a>:</h4>
<p>@Jane Lusby:  So, would that leave the assert where it current resides?  In the src directory underneath rustc_builtin_macros</p>



<a name="216425004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216425004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216425004">(Nov 12 2020 at 03:52)</a>:</h4>
<p>yea</p>



<a name="216425043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216425043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216425043">(Nov 12 2020 at 03:52)</a>:</h4>
<p>Great.  Thanks</p>



<a name="216425044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216425044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216425044">(Nov 12 2020 at 03:52)</a>:</h4>
<p>it shouldn't even really need to be a builtin afaik</p>



<a name="216425052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216425052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216425052">(Nov 12 2020 at 03:52)</a>:</h4>
<p>but there's no reason to change it to a proc macro</p>



<a name="216425074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216425074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216425074">(Nov 12 2020 at 03:52)</a>:</h4>
<p>unless compiler builtin just means internal proc macro in this case</p>



<a name="216425078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216425078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216425078">(Nov 12 2020 at 03:53)</a>:</h4>
<p>in which case don't mind me, lol</p>



<a name="216425093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216425093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216425093">(Nov 12 2020 at 03:53)</a>:</h4>
<p>Oh, but I do mind you, lol</p>



<a name="216425169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216425169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216425169">(Nov 12 2020 at 03:54)</a>:</h4>
<p>Thanks.</p>



<a name="216428857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216428857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216428857">(Nov 12 2020 at 05:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages/near/216425074">said</a>:</p>
<blockquote>
<p>unless compiler builtin just means internal proc macro in this case</p>
</blockquote>
<p>no, compiler builtins are handled specially: <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs">https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs</a></p>



<a name="216428874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216428874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216428874">(Nov 12 2020 at 05:15)</a>:</h4>
<p>(maybe you could consider them a proc-macro that also uses <code>rustc_private</code>?)</p>



<a name="216430089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430089">(Nov 12 2020 at 05:40)</a>:</h4>
<p>Is rustc_private stable?  I googled it and the impression left was unstable</p>



<a name="216430361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430361">(Nov 12 2020 at 05:46)</a>:</h4>
<p>no, rustc_private will never be stable</p>



<a name="216430365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430365">(Nov 12 2020 at 05:46)</a>:</h4>
<p>it's the compiler internals</p>



<a name="216430548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430548">(Nov 12 2020 at 05:50)</a>:</h4>
<p>what about <code>rustc_driver</code> will that be stabilized?</p>



<a name="216430622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430622">(Nov 12 2020 at 05:52)</a>:</h4>
<p>no, that's also internals</p>



<a name="216430644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430644">(Nov 12 2020 at 05:53)</a>:</h4>
<p>internals to what?</p>



<a name="216430697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430697">(Nov 12 2020 at 05:54)</a>:</h4>
<p>the rust compiler</p>



<a name="216430709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430709">(Nov 12 2020 at 05:54)</a>:</h4>
<p>sure but what's the distinction?</p>



<a name="216430716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430716">(Nov 12 2020 at 05:54)</a>:</h4>
<p>it's not part of the language</p>



<a name="216430719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430719">(Nov 12 2020 at 05:54)</a>:</h4>
<p>it's all <code>rustc</code></p>



<a name="216430720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430720">(Nov 12 2020 at 05:54)</a>:</h4>
<p>it's an API that's specific to a certain implementation</p>



<a name="216430722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430722">(Nov 12 2020 at 05:54)</a>:</h4>
<p>no?</p>



<a name="216430725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430725">(Nov 12 2020 at 05:54)</a>:</h4>
<p>rustc is a binary</p>



<a name="216430729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430729">(Nov 12 2020 at 05:54)</a>:</h4>
<p>rustc_driver is a library</p>



<a name="216430732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430732">(Nov 12 2020 at 05:54)</a>:</h4>
<p><code>rustc_*</code></p>



<a name="216430746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430746">(Nov 12 2020 at 05:55)</a>:</h4>
<p>I don't understand what you're asking.</p>



<a name="216430753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430753">(Nov 12 2020 at 05:55)</a>:</h4>
<p>so you can't use <code>rustc_driver</code>?</p>



<a name="216430763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430763">(Nov 12 2020 at 05:55)</a>:</h4>
<p>you can if you opt-in to it with <code>feature(rustc_private)</code></p>



<a name="216430771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430771">(Nov 12 2020 at 05:55)</a>:</h4>
<p>but it's not something you should be using in day-to-day code</p>



<a name="216430806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430806">(Nov 12 2020 at 05:56)</a>:</h4>
<p>OIC internals are features, no I'm just curious</p>



<a name="216430840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430840">(Nov 12 2020 at 05:57)</a>:</h4>
<p>ignore my advances</p>



<a name="216430902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216430902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216430902">(Nov 12 2020 at 05:58)</a>:</h4>
<p>So Joshua, are you saying it’s something I might be able to use with the assert?</p>



<a name="216431472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216431472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216431472">(Nov 12 2020 at 06:11)</a>:</h4>
<p>sorry, I didn't mean to be so confusing</p>



<a name="216431477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216431477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216431477">(Nov 12 2020 at 06:11)</a>:</h4>
<p><code>rustc_private</code> has nothing to do with how <code>assert!</code> is currently implemented</p>



<a name="216431480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216431480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216431480">(Nov 12 2020 at 06:11)</a>:</h4>
<p>I was speculating that in an alternative universe, you could imagine it being implemented as a proc_macro that opted in with <code>rustc_private</code></p>



<a name="216431534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216431534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216431534">(Nov 12 2020 at 06:12)</a>:</h4>
<p>forget I said anything</p>



<a name="216431548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216431548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216431548">(Nov 12 2020 at 06:13)</a>:</h4>
<p>Thanks.  I can take that option off my plate<span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="216942490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216942490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216942490">(Nov 16 2020 at 22:35)</a>:</h4>
<p>I noticed the rustc_ast crate being used. When I researched the crate, there was a note stipulating that "This API is completely unstable and subject to change." I'm wondering if someone has insight on this/is it really a matter of concern?  Thanks.</p>



<a name="216942610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216942610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216942610">(Nov 16 2020 at 22:36)</a>:</h4>
<p>It's not a matter of concern because the code you're adding is part of the same repo</p>



<a name="216943164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/216943164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#216943164">(Nov 16 2020 at 22:41)</a>:</h4>
<p>Thanks</p>



<a name="217519439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/217519439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#217519439">(Nov 21 2020 at 21:16)</a>:</h4>
<p>I want to run a test but I'm not sure if it should be a unit test or just ./x.py assert.  This will be for <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs">https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs</a>  </p>
<p>My next question is "do I write my test code/dummy code within <a href="http://assert.rs">assert.rs</a>?  If not then where.  Thanks.</p>



<a name="218955134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/218955134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#218955134">(Dec 05 2020 at 21:47)</a>:</h4>
<p>Can someone tell me where in this code the boolean expression is evaluated to true for assert!?  The code can be found at <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs">https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs</a>  I've been reading the Module rustc_ast::ast document to understand the language AST but I need to see how that one piece is evaluated in order to have an idea where I need to insert my code for additional functionality, i.e. assert_eq!  If I'm off base here just let me know but I think I'm taking the right approach.  Thanks.</p>



<a name="218956946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/218956946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#218956946">(Dec 05 2020 at 22:34)</a>:</h4>
<p>That code doesn't <em>evaluate</em> the condition; it <em>expands</em> the call to the macro to some other code. It can't evaluate the condition there because that code is run at compile-time.</p>



<a name="218956962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/218956962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#218956962">(Dec 05 2020 at 22:34)</a>:</h4>
<p>If you look at the output from <code>rustc +nightly -Z unpretty=expanded -</code>, you'll see that</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="n">assert</span><span class="o">!</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>expands to</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(prelude_import)]</span><span class="w"></span>
<span class="cp">#![no_std]</span><span class="w"></span>
<span class="cp">#[prelude_import]</span><span class="w"></span>
<span class="k">use</span><span class="w"> </span>::<span class="n">std</span>::<span class="n">prelude</span>::<span class="n">v1</span>::<span class="o">*</span><span class="p">;</span><span class="w"></span>
<span class="cp">#[macro_use]</span><span class="w"></span>
<span class="k">extern</span><span class="w"> </span><span class="k">crate</span><span class="w"> </span><span class="n">std</span><span class="p">;</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="o">!</span><span class="kc">true</span><span class="w"> </span><span class="p">{</span><span class="w"> </span>::<span class="n">core</span>::<span class="n">panicking</span>::<span class="n">panic</span><span class="p">(</span><span class="s">"assertion failed: true"</span><span class="p">)</span><span class="w"> </span><span class="p">};</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="218956979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/218956979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#218956979">(Dec 05 2020 at 22:35)</a>:</h4>
<p>That <code>if</code> expression is generated <a href="https://github.com/rust-lang/rust/blob/15eaa0020b79ad9a9a0c486d1abd00b29c6c5ae2/compiler/rustc_builtin_macros/src/assert.rs#L60-L61">here</a>:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">if_expr</span><span class="w"> </span><span class="o">=</span><span class="w"></span>
<span class="w">        </span><span class="n">cx</span><span class="p">.</span><span class="n">expr_if</span><span class="p">(</span><span class="n">sp</span><span class="p">,</span><span class="w"> </span><span class="n">cx</span><span class="p">.</span><span class="n">expr</span><span class="p">(</span><span class="n">sp</span><span class="p">,</span><span class="w"> </span><span class="n">ExprKind</span>::<span class="n">Unary</span><span class="p">(</span><span class="n">UnOp</span>::<span class="n">Not</span><span class="p">,</span><span class="w"> </span><span class="n">cond_expr</span><span class="p">)),</span><span class="w"> </span><span class="n">panic_call</span><span class="p">,</span><span class="w"> </span><span class="nb">None</span><span class="p">);</span><span class="w"></span>
</code></pre></div>



<a name="218957456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/218957456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#218957456">(Dec 05 2020 at 22:45)</a>:</h4>
<p>(deleted)</p>



<a name="218957584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/218957584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#218957584">(Dec 05 2020 at 22:49)</a>:</h4>
<p>It seems I need to modify where the if expression is generated for assert!</p>



<a name="218958453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/218958453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#218958453">(Dec 05 2020 at 23:15)</a>:</h4>
<p>I’m making assumptions that apparently aren’t based on anything concrete.  I need to follow the code from start to finish.  I just hit a bump with the AST. <span class="user-mention" data-user-id="307537">@Camelid</span> Thanks for the feedback 🙏</p>



<a name="222553599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222553599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222553599">(Jan 13 2021 at 09:21)</a>:</h4>
<p>This is the code I'm looking at: <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs">https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs</a></p>
<p>My task is to add the functionality of assert_eq to assert  such as follows:<br>
macro_rules! assert_eq {<br>
    ($left:expr, $right:expr) =&gt; ({<br>
        match (&amp;$left, &amp;$right) {<br>
            (left_val, right_val) =&gt; {<br>
                if !(*left_val == *right_val) {<br>
                    panic!(r#"assertion failed: <code>(left == right)</code><br>
  left: <code>{:?}</code>,<br>
 right: <code>{:?}</code>"#, left_val, right_val)<br>
                }<br>
            }<br>
        }<br>
    });<br>
}  </p>
<p>Where I'm at:<br>
I have read up on AST and understand that that is how the compiler represents source code and that this is done within 2 steps, lexing and parsing.  It's the parsing that takes the tokens and converts that into an AST, which, I assume is what I'm looking at at the link  <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs">https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs</a> .  I've ran the code: rustc +nightly -Z unpretty=expanded and viewed the expanded output.</p>
<p>Questions:</p>
<ol>
<li>What is the code doing at line 60 of the link I provided?</li>
<li>Will I need to add another item to struct Assert, i.e., cond_expr2, at line 65 of the link?</li>
<li>Is there a visual debug process I can use to step through the code from ASCI format to AST?  There probably isn't but I thought I'd ask.</li>
</ol>
<p>Thanks in advance for the assistance.  I'll be back on line by noon CST.</p>



<a name="222576864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222576864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222576864">(Jan 13 2021 at 13:16)</a>:</h4>
<ol start="3">
<li>I'm not sure what you mean by visual debug process, but you can use gdb on the rust compiler if you enable debug symbols. You'd set <code>debuginfo = 2</code> in config.toml (but be warned that takes a lot longer than debuginfo = 1).</li>
</ol>



<a name="222604633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222604633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222604633">(Jan 13 2021 at 16:13)</a>:</h4>
<p>Thanks @Joshua Nelson.  My first programming language was PowerBuilder which allowed one to see all the properties and their values, local, global, and shared, as you step through the code.  Again, thanks.</p>



<a name="222641659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222641659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222641659">(Jan 13 2021 at 20:35)</a>:</h4>
<p><span class="user-mention" data-user-id="344328">@Charles Ellis O'Riley Jr.</span> 1. that seems to be constructing an if statement to add to the AST</p>



<a name="222641899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222641899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222641899">(Jan 13 2021 at 20:36)</a>:</h4>
<ol start="2">
<li>I don't think so, you're probably going to want to modify how it generates <code>panic_call</code></li>
</ol>



<a name="222641981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222641981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222641981">(Jan 13 2021 at 20:37)</a>:</h4>
<p>rn what its doing is taking an assert and turning it into an if + a panic</p>



<a name="222642003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642003">(Jan 13 2021 at 20:37)</a>:</h4>
<p><code>assert (bool) =&gt; if bool { panic }</code></p>



<a name="222642231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642231">(Jan 13 2021 at 20:39)</a>:</h4>
<p>this line right here is probably the most relevant one</p>



<a name="222642233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642233">(Jan 13 2021 at 20:39)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs#L55">https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs#L55</a></p>



<a name="222642249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642249">(Jan 13 2021 at 20:39)</a>:</h4>
<p>where it takes the expression of the assert and turns it into a string to print in the panic</p>



<a name="222642373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642373">(Jan 13 2021 at 20:40)</a>:</h4>
<p>instead of just stringifying the expression you're going to want to print the values on the left and right side of the boolean expr in the assert, if applicable</p>



<a name="222642417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642417">(Jan 13 2021 at 20:40)</a>:</h4>
<p><span class="user-mention" data-user-id="344328">@Charles Ellis O'Riley Jr.</span> would it help if I wrote up some more detailed instructions on the steps to take?</p>



<a name="222642733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642733">(Jan 13 2021 at 20:43)</a>:</h4>
<p>@Jane Lusby, for <a href="https://github.com/rust-lang/rust/issues/2">#2</a>, I kind of thought that’s what was going on so I assume I’ll need to add on to it.  For <a href="https://github.com/rust-lang/rust/issues/1">#1</a>, I’ll have to flesh out what you’re saying.  Perhaps I’ll get a better understanding once I set up debug.  Thanks for the reply.</p>



<a name="222642827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642827">(Jan 13 2021 at 20:44)</a>:</h4>
<p>np, to clarify on 1.</p>



<a name="222642904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642904">(Jan 13 2021 at 20:45)</a>:</h4>
<p>what I mean is, when rustc compiles code you know how it loads the source file, tokenizes it, and then makes the ast (not sure this is exactly correct but it should be close enough)</p>



<a name="222642926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642926">(Jan 13 2021 at 20:45)</a>:</h4>
<p>where the AST is just rust structs that represent rust source</p>



<a name="222642946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642946">(Jan 13 2021 at 20:45)</a>:</h4>
<p>so instead of <code>if bool { body }</code> you have something like</p>



<a name="222642971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222642971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222642971">(Jan 13 2021 at 20:45)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">IfStatement</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">predicate</span>: <span class="nc">BoolExpr</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">body</span>: <span class="nc">Block</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="222643060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222643060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222643060">(Jan 13 2021 at 20:46)</a>:</h4>
<p>not real AST but hopefully this makes it clear what it means</p>



<a name="222643074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222643074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222643074">(Jan 13 2021 at 20:46)</a>:</h4>
<p>the <code>let if_expr =
        cx.expr_if(sp, cx.expr(sp, ExprKind::Unary(UnOp::Not, cond_expr)), panic_call, None);</code></p>



<a name="222643090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222643090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222643090">(Jan 13 2021 at 20:46)</a>:</h4>
<p>is creating one of those if expression structs</p>



<a name="222643139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222643139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222643139">(Jan 13 2021 at 20:46)</a>:</h4>
<p>which it's then substituting in place of the <code>assert!</code> macro expression in the original source</p>



<a name="222643154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222643154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222643154">(Jan 13 2021 at 20:47)</a>:</h4>
<p>or something like that</p>



<a name="222643855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222643855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222643855">(Jan 13 2021 at 20:53)</a>:</h4>
<p>Gotcha.  that makes sense.  So, at line 65, will I need to add another cond_expr such as cond_expr2?  Not sure how that would work.  I'm just thinking ahead.</p>



<a name="222644276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222644276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222644276">(Jan 13 2021 at 20:56)</a>:</h4>
<p>I don't think you'll need a new conditional expression</p>



<a name="222644523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222644523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222644523">(Jan 13 2021 at 20:58)</a>:</h4>
<p>I think the first step <span class="user-mention" data-user-id="344328">@Charles Ellis O'Riley Jr.</span>  is that you'll want to create the debug code for printing the condition</p>



<a name="222644537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222644537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222644537">(Jan 13 2021 at 20:58)</a>:</h4>
<p>and just prove that that works</p>



<a name="222644589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222644589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222644589">(Jan 13 2021 at 20:58)</a>:</h4>
<p>let me do a little digging</p>



<a name="222644617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222644617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222644617">(Jan 13 2021 at 20:58)</a>:</h4>
<p>thanks</p>



<a name="222650120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222650120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222650120">(Jan 13 2021 at 21:44)</a>:</h4>
<p>okay <span class="user-mention" data-user-id="344328">@Charles Ellis O'Riley Jr.</span> it turns out this code was already implemented in <a href="https://github.com/de-vri-es/assert2-rs">https://github.com/de-vri-es/assert2-rs</a></p>



<a name="222650159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222650159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222650159">(Jan 13 2021 at 21:45)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="359973">@Maarten de Vries</span></p>



<a name="222650204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222650204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222650204">(Jan 13 2021 at 21:45)</a>:</h4>
<p>this bit is the important one</p>



<a name="222650205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222650205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222650205">(Jan 13 2021 at 21:45)</a>:</h4>
<p><a href="https://github.com/de-vri-es/assert2-rs/blob/main/src/maybe_debug.rs">https://github.com/de-vri-es/assert2-rs/blob/main/src/maybe_debug.rs</a></p>



<a name="222650254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222650254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222650254">(Jan 13 2021 at 21:46)</a>:</h4>
<p>where he used autoderef specialization to create the fallback formatting</p>



<a name="222650574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222650574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222650574">(Jan 13 2021 at 21:48)</a>:</h4>
<p>and <a href="https://github.com/de-vri-es/assert2-rs/blob/main/assert2-macros/src/lib.rs#L60-L85">https://github.com/de-vri-es/assert2-rs/blob/main/assert2-macros/src/lib.rs#L60-L85</a> is where it gets used</p>



<a name="222650580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222650580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222650580">(Jan 13 2021 at 21:48)</a>:</h4>
<p>to create the better panic</p>



<a name="222650624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222650624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222650624">(Jan 13 2021 at 21:48)</a>:</h4>
<p>so you're gonna need to create something like this to replace the current <code>panic_call</code> on line 65</p>



<a name="222650843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222650843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222650843">(Jan 13 2021 at 21:50)</a>:</h4>
<p>important to note though, assert2-rs uses syn + quote</p>



<a name="222650856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222650856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222650856">(Jan 13 2021 at 21:50)</a>:</h4>
<p>since it's an external proc macro</p>



<a name="222650908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222650908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222650908">(Jan 13 2021 at 21:51)</a>:</h4>
<p>so the way you actually create a type like this will be different, using the equivalent rustc APIs</p>



<a name="222651000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222651000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222651000">(Jan 13 2021 at 21:51)</a>:</h4>
<p><span class="user-mention" data-user-id="220273">@Jane Lusby</span>  Line 65 of <a href="http://assert.rs">assert.rs</a>?</p>



<a name="222651016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222651016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222651016">(Jan 13 2021 at 21:51)</a>:</h4>
<p>yes</p>



<a name="222651070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222651070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222651070">(Jan 13 2021 at 21:52)</a>:</h4>
<p>the <code>expr_if</code> line we were talking about before</p>



<a name="222651173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222651173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222651173">(Jan 13 2021 at 21:53)</a>:</h4>
<p>@Jane Lusby This is what's at line 65</p>
<p>struct Assert {<br>
    cond_expr: P&lt;ast::Expr&gt;,<br>
    custom_message: Option&lt;TokenStream&gt;,<br>
}</p>



<a name="222651271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222651271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222651271">(Jan 13 2021 at 21:53)</a>:</h4>
<p>sorry i meant 61</p>



<a name="222651274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222651274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222651274">(Jan 13 2021 at 21:53)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs">https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs</a></p>



<a name="222651283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222651283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222651283">(Jan 13 2021 at 21:53)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs#L61">https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs#L61</a></p>



<a name="222651382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Nicer%20Assert%20Messages/near/222651382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Nicer.20Assert.20Messages.html#222651382">(Jan 13 2021 at 21:54)</a>:</h4>
<p>Ok.  Let me look at it.  Thanks.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>